import React from 'react';
import { Router, Route, IndexRedirect } from 'react-router';
// 各种页面

// 首页
import HOME_PAGE from 'Page/HomePage';
// 食安展示
import DISPLAY_PAGE from 'Page/DisplayPage';
import NORMAL_WORK_PAGE from 'Page/DisplayPage/NormalWork';
import WORK_REPORT_DETAIL_PAGE from 'Page/DisplayPage/NormalWork/WorkReportDetail';
import VIDEO_PUBLIC_PAGE from 'Page/DisplayPage/VideoPublic';
import VR_PAGE from 'Page/DisplayPage/VRpage';
import VIDEO_DETAIL from 'Page/DisplayPage/VideoPublic/VideoDetail';
import VR_DETAIL from 'Page/DisplayPage/VRpage/VrDetail';
import TEST_PAGE from 'Page/DisplayPage/TestPage';
// 便民服务
import SERVER_PAGE from 'Page/ServerPage';
import RUN_ONCE from 'Page/ServerPage/RunOnce';
import MARKET_INSTITUTION_NAVIGATION from 'Page/ServerPage/MarketInstitutionNavigation/MarketInstitutionNavigation';
import SHIAN_MAP from 'Page/ServerPage/ShiAnMap/ShiAnMap';
import SUN_KITCHEN from 'Page/ServerPage/SunKitchenPage/SunKitchen';
import PROCESS_DETAIL from 'Page/ServerPage/RunOnce/processDetail';
// 互动平台
import INTERACTIVE_PAGE from 'Page/InteractivePage';
import COMPLAINT_PAGE from 'Page/InteractivePage/ComplaintPage';
import REPORT_PAGE from 'Page/InteractivePage/ComplaintPage/Report';
import DOUBLE_RANDOM_PAGE from 'Page/InteractivePage/DoubleRandomPage';
import MAKE_APPOINTMENT from 'Page/InteractivePage/DoubleRandomPage/MakeAppointment';
import SPEAK_PAGE from 'Page/InteractivePage/SpeakPage/index';
import ADVICE_DETAILS from 'Page/InteractivePage/SpeakPage/AdviceDetails';
import EXAM_LOGIN from 'Page/InteractivePage/KnowledgePage/ExamLogin';
import EXAM_DETAIL from 'Page/InteractivePage/KnowledgePage/ExamDetail';
import SUPERVISE_ONLINE from 'Page/InteractivePage/SuperviseOnLinePage';
import SPEAK_DETAIL_PAGE from 'Page/InteractivePage/SpeakPage/SpeakDetail';
import APPONIT_DETAIL_PAGE from 'Page/InteractivePage/DoubleRandomPage/AppointDetail';
import COMPONENT_DETAIL_PAGE from 'Page/InteractivePage/ComplaintPage/ComplaintDetail';
import EXAM_HOME from 'Page/InteractivePage/KnowledgePage';
//import SUPERVISE from 'Page/InteractivePage/Supervise';


import PAGE_CONTAINER from '../containers/PageContainer';
import { validate, canTest } from './enterHandles';
import { history } from '../store/configureStore';

class DevRoute extends React.PureComponent {
  render() {
    return (
      <Router history={history}>
        <Route path="/" onEnter={validate} component={PAGE_CONTAINER}>
          <IndexRedirect to="/home" />
          {/* 首页 */}
          <Route path="/home" component={HOME_PAGE} />
          {/* 食安展示 */}
          <Route path="/display" component={DISPLAY_PAGE}>
            <IndexRedirect to="/display/video" />
            <Route path="/display/work" component={NORMAL_WORK_PAGE} />
            <Route path="/display/video" component={VIDEO_PUBLIC_PAGE} />
            <Route path="/display/vr" component={VR_PAGE} />
            <Route path="/display/test" component={TEST_PAGE} />

            <Route path="/display/work/report/:id" component={WORK_REPORT_DETAIL_PAGE} />
            <Route path="/display/video/video_detail/:id" component={VIDEO_DETAIL} />
            <Route path="/display/vr/vr_detail/:id" component={VR_DETAIL} />
          </Route>
          {/* 便民服务 */}
          <Route path="/server" component={SERVER_PAGE} >
            <IndexRedirect to="/server/run_once" />
            <Route path="/server/run_once" component={RUN_ONCE} />
            <Route path="/server/market_institution_navigation" component={MARKET_INSTITUTION_NAVIGATION} />
            <Route path="/server/sun_kitchen/:id" component={SUN_KITCHEN} />
            <Route path="/server/shiAn_map" component={SHIAN_MAP} />

            <Route path="/server/run_once/process_detail/:id" component={PROCESS_DETAIL} />
          </Route>
          {/* 互动平台 */}
          <Route path="/interactive" component={INTERACTIVE_PAGE} >
            <IndexRedirect to="/interactive/complaint" />
            <Route path="/interactive/complaint" component={COMPLAINT_PAGE} />
            <Route path="/interactive/double_random" component={DOUBLE_RANDOM_PAGE} />
            <Route path="/interactive/speak" component={SPEAK_PAGE} />
            <Route path="/interactive/knowledge" component={EXAM_HOME} />
            <Route path="/interactive/supervise_online" component={SUPERVISE_ONLINE} />

            <Route path="/interactive/complaint/report" component={REPORT_PAGE} />
            <Route path="/interactive/double_random/make_appointment" component={MAKE_APPOINTMENT} />
            <Route path="/interactive/speak/advice_details" component={ADVICE_DETAILS} />
            <Route path="/interactive/knowledge/login" component={EXAM_LOGIN} />
            <Route path="/interactive/complaint/component_detail/:id" component={COMPONENT_DETAIL_PAGE} />
            <Route path="/interactive/speak/speak_detail/:id" component={SPEAK_DETAIL_PAGE} />
            <Route path="/interactive/double_random/appoint_detail/:id" component={APPONIT_DETAIL_PAGE} />
          </Route>

          <Route path="/interactive/knowledge/exam_detail" onEnter={canTest} component={EXAM_DETAIL} />
        </Route>
      </Router>
    );
  }
}

export default DevRoute;
